package com.zhiyou100.review.day011.baseclasslibrary;

import java.util.Objects;

/**
 * @packageName: Student
 * @className: com.zhiyou100.review.day011.baseclasslibrary
 * @Description: TODO 测试 学生类
 * @author: yang
 * @date: 6/17/20
 */
public class Student {
    int age;
    char gender;
    String name;

    public Student(int age, char gender, String name) {
        this.age = age;
        this.gender = gender;
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        // 判断参数对象是否是当前类型
        if (!(o instanceof Student)) {
            return true;
        }
        Student student = (Student) (o);
        // 转换

        // 根据需求比较
        return student.age == this.age && student.gender == this.gender && Objects.equals(student.name, this.name);
    }

    @Override
    public String toString()
    {
        return "Student{" +
                "age=" + age +
                ", gender=" + gender +
                ", name='" + name + '\'' +
                '}';
    }

    @Override
    public int hashCode() {
        return 0;
    }
}
